# Contributor: Kaarle Ritvanen <kunkku@alpinelinux.org>
# Maintainer: Kaarle Ritvanen <kunkku@alpinelinux.org>
pkgname=ipset
pkgver=7.19
pkgrel=2
pkgdesc="Manage Linux IP sets"
url="https://ipset.netfilter.org/"
arch="all"
license="GPL-2.0-only"
depends_dev="libmnl-dev"
makedepends="$depends_dev automake autoconf libtool linux-headers"
checkdepends="bash iptables"
options="!check" # Tests require privileges to load kernel modules
subpackages="$pkgname-dev $pkgname-doc $pkgname-openrc"
source="https://ipset.netfilter.org/ipset-$pkgver.tar.bz2
	ipset.initd
	"

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--with-kmod=no \
		--prefix=/usr
	make
}

check() {
	make tests
}

package() {
	make install DESTDIR="$pkgdir"

	mkdir -p "$pkgdir/etc/init.d" \
		"$pkgdir/etc/ipset.d"
	install -m 755 "$srcdir/ipset.initd" "$pkgdir/etc/init.d/ipset"
}

sha512sums="
0f4252e6d967b0f130a2c7a0307b17c6b7d48336e86b2f838ea176f5faaa0c9bbbf273060906b43d91e9b38a9f33c18918e33d02292839a6bc321181d5d7f84e  ipset-7.19.tar.bz2
4c4492258a39b94ef7cdf193d73060af28bef05aad305743f9db698f08d4e89352788e72ef98fad7c099aef0937f333e0b84a5df0ae27740fa2626654576f89c  ipset.initd
"
